home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gigarom 1
/
Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso
/
FILES
/
DEM
/
I-M
/
LineShare DEMO.sea
/
LineShare Scripts
/
ZyXEL Fax&MultiData
< prev
next >
Wrap
Text File
|
1992-12-25
|
6KB
|
278 lines
!
! LineShare™ Script for ZyXEL U-1496 modems
!
! This script is designed to use with fax and several data services:
! TeleFinder™ BBS ("TF" subPort)
! QuickMail™ MailServer ("Mail" subPort)
! The script displays the menu: this lines are marked with "@@@"
! The choice is done manually by the user when connecting to the host.
!
! For some reasons TeleFinder redefines the LineFeed character (S4)
! We don't redefine it really, but we emulate modem responses with that symbol
! This trick is done in lines marked with '$$$$'
!
! If you want to modify this script for your modem, pay attention to
! the line marked "#### Settings ####" - it should be modified first
!
! The TeleFinder "Host Options" used:
! "Adjust BPS to line speed" - *disabled* (since we alsways return "CONNECT 19200")
! "Use Break Reset" - *enabled*,
!
! The QuickMail options (through CTB module:)
! Don't adjust speed (since we alsways return "CONNECT 19200")
!
!
! ------------------------------------------
! Resetting the modem:
! ------------------------------------------
@Hangup
SetTries 2
Flush
HsReset 0,0,17,19,0,0
!
! Try to catch the "OK" answer, use the Escape seq and DTR transitions
! to enter the command mode
!
@Label 1
matchclr
matchstr 1 2 "OK\r\n"
write "ATH0&F\r"
matchread 20
Write "+++"
DtrClear
pause 10
DtrSet
!
DecTries
IfTries 0 1
!
! OSErr -6019 "Modem error - the modem is not responding"
!
exit -6019
@Label 2
write "AT+FCLASS=0\r"
Jsr 100
write "AT+FAA=0\r"
Jsr 100
exit 0
! ------------------------------------------
! Receiving incoming calls
! ------------------------------------------
@ANSWER
@Label 10
!
! Set the modem preferred speed first
!
SERRESET 2400,0,8,1
Jsr 80
!
! Set the common options
Jsr 70
!
! Set the communication options:
! Extended response set
! &K4 - Enable MNP for TeleFinder and mail
! &H4 - Xon/Xoff flow control (for Fax)
! Fax mode (to enable fax tuning commands)
!
@Label 11
! #### Settings ####
Write "ATX4&H4&K4+FCLASS=2\r"
Jsr 100
!
! Set the "work" speed
!
@Label 12
SERRESET 19200,0,8,1
Jsr 80
!
! Set Fax parameters: LID, DCC,BOR
!
Write "AT+FLID=\"Stalker_GmbH\"\r"
Jsr 100
Write "AT+FDCC=1,3,0,2,0,0,0,0\r"
Jsr 100
Write "AT+FBOR=1\r"
Jsr 100
!
! Allow modem to receive fax messages
!
Write "AT+FCR=1\r"
Jsr 100
!
! Tell the modem to determine the type of the incoming call
! Fetch the tube after N rings, where N has been set in the control panel (^4)
!
Write "ATS0=^4+FAA=1\r"
Jsr 100
!
! Everything is ready - let's sit and wait for a call
! We'll wait for 2 minutes, then reinitiate the modem
@Label 20
MatchClr
matchstr 1 20 "RING\r"
matchstr 2 21 "CONNECT"
matchstr 13 30 "+FCON"
matchstr 14 10 "\r\nNO "
matchstr 15 10 "BUSY"
Matchread 1200
jump 10
!
! Data connection has been established (we read "CONNECT")
! Remove everything till "\r\n" from the buffer
@Label 21
MatchClr
MatchStr 1 22 "\r\n"
MatchRead 10
exit -6019
@Label 22
!
! Display our menu
! @@@
Write "\r\n\n\n\nWelcome to Stalker Multi-Service Host!\r\n"
Write "\r\nPress a key to connect to:\r\n"
Write "M - TeleFinder(tm) BBS\r\n"
Write "Q - QuickMail(tm) mail-server\r\n"
Write "=>"
MatchClr
MatchStr 1 24 "M"
MatchStr 2 24 "m"
MatchStr 3 25 "Q"
MatchStr 4 25 "q"
MatchStr 5 23 "\r"
MatchRead 150
@Label 23
exit -6019
!
! Emulate the CONNECT 19200 message
! Attach the "TF" subPort
! The letter "M" is also put into the buffer,
! since it could be part of TeleFinder "MMM" 'entry mark'
!
@Label 24
Write "M\r\n\r\nConnecting to TeleFinder...\r\n"
QueueInput "\r\27CONNECT 19200\r\27M"
Attach "TF" (DTR,BREAK,RESET,ESCAPE,IDLELIMIT=60)
!
! Emulate the CONNECT 19200 message
! Attach the "Mail" subPort
! The symbol "\r" is also put into the buffer,
! to force QuickMail to start the session
!
@Label 25
Write "Q\r\n\r\nConnecting to QuickMail...\r\n"
QueueInput "\r\nCONNECT 19200\r\n\r"
Attach "Mail" (DTR,ESCAPE)
!
! Fax connection has been established (we read "+FCON")
! Put the +FCON back to the buffer,
! Put the "RING" before the "+FCON"
! Attach the "Fax" subPort
!
@Label 30
QueueInput "\r\nRING\r\n\r\n+FCON"
Attach "Fax" (DTR,RESET,ESCAPE,IDLELimit=30)
! ------------------------------------------
! Originating a call through the "Fax" subPort
! ------------------------------------------
@ORIGINATE "Fax"
!
! Set the "Fax" speed
!
SERRESET 19200,0,8,1
Jsr 80
!
! Set the common options
!
Jsr 70
!
! Set the Fax mode
!
Write "AT+FCLASS=2\r"
Jsr 100
!
! Now emit all commands that the application has sent to that port,
! Prepare to receive all error result codes
!
!EmitClear "S","S","S","&","&","\\","\\"
Jsr 60
!
! Prepare to connect
!
Jsr 90
MatchStr 1 51 "\r\n+FCON"
HsReset *
Write "ATD^1\r"
MatchRead 700
Write "\r"
Exit -6019
@LABEL 51
QueueInput "\r\n+FCON"
Attach "Fax" (DTR,RESET,ESCAPE,IDLELimit=30)
!
! This section emits all modem commands sent by the client application
! For each set of commands the "OK" answer is awaited
!
@Label 60
EmitStart
@Label 61
EmitCommand 62
Jsr 100
Jump 61
@Label 62
return
!
! This section initiates the modem before ANSWER and ORIGINATEs:
! factory settings + speaker control +
! reset on Dtr drop + DCD valid
! Verbal responses mode, no echo
! Set &S1 (DSR) in case the cable connects the DSR signal with the CTS pin
!
@Label 70
Write "ATM^2L^3&D2&C1V1E0\r"
Jsr 100
return
!
! This section syncronize the modem after the serial port speed switching
!
@Label 80
ChrDelay 1
Write "AT\r"
ChrDelay 0
Jsr 100
return
!
! Prepare to receive error result codes
!
@Label 90
MatchClr
MatchStr 2 91 "NO DIALTONE\r\n"
MatchStr 3 92 "BUSY\r\n"
MatchStr 4 93 "NO CARRIER\r\n"
MatchStr 5 94 "NO ANSWER\r\n"
return
@Label 91
exit -6020
@Label 92
exit -6022
@Label 93
exit -6021
@Label 94
exit -6023
!
! Processing the AT command:
! OK -> proceed
! ERROR or TimeOut ->exit -6019
! It can be called AFTER the "Write" command, since LineShare buffers input
!
@Label 100
MatchClr
MatchStr 1 102 "\r\nOK\r\n"
MatchStr 2 101 "\r\nERROR\r\n"
MatchRead 20
@Label 101
Exit -6019
@Label 102
return